import { Builder, By, Key, until } from 'selenium-webdriver'
import fakeUa from 'fake-useragent'

console.log(fakeUa());
console.log(fakeUa());
console.log(fakeUa());
console.log(fakeUa());

(async function example() {
  const driver = await new Builder().forBrowser('chrome').build();
  await driver.get('https://www.baidu.com');
  await driver.findElement(By.id('kw')).sendKeys('黑马程序员', Key.ENTER);
  console.log(await driver.wait(until.titleIs('黑马程序员_百度搜索'), 1000))
})();